<?php

class Chat extends API_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('chat_model');
    }

    public function index(){
        $params = $this->params;
        if(empty($params['fb_id']) == TRUE){
            $this->response('INVALID_PARAMS');
        }
        
        $args['fb_id'] = intval($params['fb_id']);
        $key = empty($params['key']) == TRUE ? NULL : $params['key'];
        
        $result = $this->chat_model->get_active($args, $key);
        if(empty($result) == FALSE){
            $this->response('GET_SUCCESS', $result);
        }else{
            $this->response('GET_FAIL', $result);
        }
    }

}
